﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BCL.Repository;
using Azad;

public partial class Admin_Mapping : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        BindDropDown();
    }

    void BindDropDown()
    {
        int id = Convert.ToInt32(Request.QueryString["id"]);
        NewsRepository newsrepo = new NewsRepository();
        var news = newsrepo.Get(id);
        var detail = news.Detail;

        var detailToDetail = detail.Where(f => f.MenuId == 11).FirstOrDefault().DetailToDetail;

        source_url3.DataTextField = "FileName";
        source_url3.DataValueField = "Id";
        source_url3.DataSource = detailToDetail;

        source_url3.DataBind();

        SilverlightService bcl = new SilverlightService();

        ddlMenu.DataTextField = "Description";
        ddlMenu.DataValueField = "LookUpID";
        ddlMenu.DataSource = bcl.GetTopMenu();

        ddlMenu.DataBind();

        ddlMenu.Items.Insert(0, new ListItem("Please Select", "0"));

        System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
        var detailJson = serializer.Serialize(detailToDetail);
        SerializedObject.Text = "<script type=\"text/javascript\">var logoInfoId = " + id + "; var detailToDetail = " + detailJson + ";</script>";
    }
}